package com.ruoyi.resume.mapper;

import com.ruoyi.resume.domain.model.resumeProfile.EducationBackground;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EducationBackgroundMapper {

    @Select("SELECT school_name, major_name, start_date, end_date, degree, related_courses " +
            "FROM education WHERE resume_id = #{resumeId}")
    @Results({
            @Result(column = "school_name", property = "schoolName"),
            @Result(column = "major_name", property = "majorName"),
            @Result(column = "start_date", property = "startTime"),
            @Result(column = "end_date", property = "endTime"),
            @Result(column = "degree", property = "degree"),
            @Result(column = "related_courses", property = "relatedCourses")
    })
    List<EducationBackground> selectByResumeId(@Param("resumeId") int resumeId);

    @Delete("DELETE FROM education WHERE resume_id = #{resumeId}")
    void deleteByResumeId(int resumeId);
}
